package com.bupt.exceptions;



import com.alibaba.fastjson.JSON;
import com.bupt.enums.ResultCode;
import lombok.Data;

/**
 * @author 阿甘
 * @see https://study.163.com/course/courseMain.htm?courseId=1004348001&share=2&shareId=1016671292
 * @version 1.0
 * 注：如有任何疑问欢迎加入QQ群977438372 进行讨论
 */

//这个是自定义的异常

public class BusinessException extends RuntimeException {

	public Integer code;

	public String message;

	public BusinessException(Integer code, String message) {
		super("{\"code\":" + code + ",\"message\":" + message + "}");
		this.code = code;
		this.message = message;

	}

	public BusinessException(ResultCode resultCode) {
		super("{\"code\":" + resultCode.code() + ",\"message\":\"" + resultCode.message() + "\"}");
		this.code = resultCode.code();
		this.message = resultCode.message();
	}

}
